package org.example.controller;

import org.example.BusinessExcption;
import org.example.Service.UserService;
import org.example.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping
@CrossOrigin
public class UserController {
    @Autowired
    private UserService userService;
    @PostMapping("login")
    public User login(@RequestBody User user) {
        try {
            User user1 = userService.login(user.getUsername(), user.getPass());
            return user1;
        } catch (BusinessExcption businessExcption) {
            System.out.println("登录异常：" + businessExcption.getMessage());
        }
        return null;
    }
}
